package com.seaboxdata.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author
 * @create 2021-11-8 16:03
 **/
@Data
@TableName("base_db.rsp_data_monitor_result")
public class RspDataMonitorResult {
    /**
     * $column.comments
     */
    private String monitorDay;
    /**
     * $column.comments
     */
    private String url;
    /**
     * $column.comments
     */
    private String tableName;
    /**
     * $column.comments
     */
    private Date monitorDate;
    /**
     * $column.comments
     */
    private Integer totalCount;
    /**
     * $column.comments
     */
    private String result;

    /**
     * $column.comments
     */
    private Date lastUpdateTime;

    public void setLastUpdateTime(Object lastUpdateTime) {
        SimpleDateFormat simpleDateFormat =
                new SimpleDateFormat("yyyy-MM-dd");
        if(lastUpdateTime != null && lastUpdateTime instanceof Date){
            this.lastUpdateTime = (Date) lastUpdateTime;
        }else if(lastUpdateTime != null && lastUpdateTime instanceof String){
            try {
                this.lastUpdateTime = simpleDateFormat.parse((String)lastUpdateTime);
            } catch (ParseException e) {
                this.lastUpdateTime = null;
            }
        }else{
            this.lastUpdateTime = null;
        }
    }
}
